/*
 * @Author: chenzanjing
 * @Date: 2023-07-31 14:32:17
 * @LastEditors: chenzanjing
 * @LastEditTime: 2023-07-31 15:07:23
 * @FilePath: \teaching-management-front\src\components\verifition\utils\ase.js
 * @Description:
 *
 * Copyright (c) 2023 by ${sylar}, All Rights Reserved.
 */
import CryptoJS from "crypto-js";
/**
 * @word 要加密的内容
 * @keyWord String  服务器随机返回的关键字
 *  */
export function aesEncrypt(word, keyWord = "XwKsGlMcdPMEhR1B") {
  let key = CryptoJS.enc.Utf8.parse(keyWord);
  let srcs = CryptoJS.enc.Utf8.parse(word);
  let encrypted = CryptoJS.AES.encrypt(srcs, key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 });
  return encrypted.toString();
}
